/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Zimlet;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DeleteZimlet
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 37 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 38 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 40 */     Element z = request.getElement("zimlet");
/* 41 */     String name = z.getAttribute("name");
/*    */     
/* 43 */     Zimlet zimlet = prov.getZimlet(name);
/* 44 */     if (zimlet == null) {
/* 45 */       throw AccountServiceException.NO_SUCH_ZIMLET(name);
/*    */     }
/* 47 */     checkRight(zsc, context, zimlet, Rights.Admin.R_deleteZimlet);
/*    */     
/* 49 */     String id = zimlet.getId();
/* 50 */     prov.deleteZimlet(name);
/*    */     
/* 52 */     ZimbraLog.security.info(ZimbraLog.encodeAttrs(new String[] { "cmd", "DeleteZimlet", "name", name, "id", id }));
/*    */     
/* 54 */     Element response = zsc.createElement(AdminConstants.DELETE_ZIMLET_RESPONSE);
/* 55 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 60 */     relatedRights.add(Rights.Admin.R_deleteZimlet);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/DeleteZimlet.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */